<template>
  <h1>EL-表单组件</h1>
  <el-form label-width="80px" style="width: 30%;margin: 0 auto;">
    <el-form-item label="用户名">
      <el-input placeholder="请输入用户名" v-model="users.username"></el-input>
    </el-form-item>
    <el-form-item label="密码">
     <el-input placeholder="请输入密码" v-model="users.password" show-password></el-input>
    </el-form-item>
    <el-form-item label="性别">
      <el-radio-group v-model="users.gender">
        <el-radio-button label="男" value="M"></el-radio-button>
        <el-radio-button label="女" value="W"></el-radio-button>
      </el-radio-group>
    </el-form-item>
    <el-form-item label="城市">
      <el-select placeholder="请选择" v-model="users.city">
        <el-option label="A城" value="A"></el-option>
        <el-option label="B城" value="B"></el-option>
        <el-option label="C城" value="C"></el-option>
      </el-select>
    </el-form-item>
    <el-form-item label="开关">
      <el-switch v-model="users.isAdmin"></el-switch>
    </el-form-item>
    <el-form-item>
      <el-button type="success" style="margin: 0 auto" @click="show()">注册</el-button>
    </el-form-item>
  </el-form>
</template>

<script setup>
import {ref} from "vue";

const users = ref({
  username: "",
  password: "",
  gender: "",
  city: "",
  isAdmin: false
});
const show = () => {
  console.log(users.value);
}
</script>

<style scoped>

</style>